/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package restaurant;

import java.util.ArrayList;
import java.util.Iterator;

/**
 *
 * @author Thays
 */
public class Order {//Mapeia o pedido de uma mesa
        private int cod;
        private int tableNumber;
        private boolean bill;//false = conta não fechada, true = conta fechada
        private double totalBill;
        private double tenPercent = totalBill*0.1;
        public ArrayList<Item> itens;
        public Order(){
            tableNumber = 0;
            totalBill = 0;
            tenPercent = 0;
            bill = false;
            itens = new ArrayList<>();
        }
        public void setTableNumber(int table){
            tableNumber = table;
        }
        public int getTableNumber(){
            return tableNumber;
        }
        public void setBill(boolean bill){
            this.bill = bill;
        }
        public boolean getBill(){
            return bill;
        }
        public void setCode(int cod){
            this.cod = cod;
        }
        public int getCode(){
            return cod;
        }
        public double getTotalBill(){
            Iterator<Item> i = itens.iterator();
            while(i.hasNext()){
                Item item = i.next();
                totalBill += item.getPrice();
            }
            return totalBill;
        }
       
}
